﻿-- =========================================================================================================
-- Author:		MICHAEL RITACCO
-- Copyright:	2010 MEKHANO GROUP LLC
-- Version:		10/02/2010 1.0
-- =========================================================================================================
CREATE PROCEDURE [flcr].[api_sla_sel_lov]
@SLA_ID INT = NULL
,@ACTIVE_FLG BIT = NULL
,@BUILTIN BIT = NULL
,@CONTRACT_ID INT = NULL
,@SLA_TYPE INT = NULL

AS
BEGIN TRY
  
	SELECT	A.[SLA_ID]
			,A.[SLA_NAME]
			,A.[SLA_SNAME]
			,A.[SORT_ORDER]
			,A.[SLA_TYPE]
			,B.[SLA_TYPE_NAME] 
	  FROM	[FLCR].[SLA] A
	 INNER JOIN [FLCR].[SLA_TYPE] B
		ON	A.[SLA_TYPE] = B.[SLA_TYPE] 
     WHERE	A.[SLA_ID] = COALESCE(@SLA_ID,A.[SLA_ID])
	   AND	A.[BUILTIN] = COALESCE(@BUILTIN,A.[BUILTIN])
	   AND	A.[ACTIVE_FLG] = COALESCE(@ACTIVE_FLG,A.[ACTIVE_FLG])
	   AND	A.[CONTRACT_ID] = COALESCE(@CONTRACT_ID,A.[CONTRACT_ID])
	   AND	A.[SLA_TYPE] = COALESCE(@SLA_TYPE,A.[SLA_TYPE])

END TRY
BEGIN CATCH
	EXEC [flcr].[utl_getDBError];
END CATCH
